fileList.forEach((file) => {
  const r = new FileReader();
  r.readAsArrayBuffer(file);
  r.onload = e => {
    file.status = 'uploading';
    this.setState({
      fileList,
    });
    axios({
      method: 'post',
      url: `${action}/${uploadTypeNum}`,
      data: e.target.result,
      onUploadProgress: progressEvent => {
        const complete = (progressEvent.loaded / progressEvent.total * 100 | 0);
        file.percent = complete;
        this.setState({
          fileList,
        });
      },
    })
      .then(res => {
        if (res.status === 200 && res.data.state === 'success') {
          file.status = 'success';
          file.code = res.data.code;
          this.setState((state) => ({
            uploading: false,
          }));
          this.setState({
            fileList,
          });
        } else {
          this.setState({
            uploading: false,
          });
          file.status = 'error';
          this.setState({
            fileList,
          });
          message.error(`${file.name}上传失败`);
        }
      })
      .catch(() => {
        this.setState({
          uploading: false,
        });
        message.error(`${file.name}上传失败了`);
        file.status = 'error';
        this.setState({
          fileList,
        });
      });
  };
});
